<html>
<head>
<title>BNA - Atlas BNA</title>
</head>

<body bgcolor="#ffffff">

<h1>BNA - Atlas BNA</h1>

The BNA format is an ASCII exchange format for 2D vector data supported
by many software packages.
It only contains geometry and a few identifiers per record. Attributes must be stored into external files.
It does not support any coordinate system information.<p>

OGR has support for BNA reading and writing.<p>

The OGR driver supports reading and writing of all the BNA feature types :
<ul>
<li>points</li>
<li>polygons</li>
<li>lines</li>
<li>ellipses/circles</li>
</ul>

As the BNA format is lacking from a formal specification, there can be various
forms of BNA data files. The OGR driver does it best to parse BNA datasets and supports
single line or multi line record formats, records with 2, 3 or 4 identifiers,
etc etc. If you have a BNA data file that cannot be parsed correctly by the BNA driver,
please report on the GDAL track system.<p>

To be recognized as BNA, the file extension must be ".bna".
When reading a BNA file, the driver will scan it entirely to find out which layers are
available. If the file name is foo.bna, the layers will be named foo_points, foo_polygons, foo_lines and foo_ellipses.<p>

The BNA driver support reading of polygons with holes or lakes. It determines what is a hole or a lake only from
geometrical analysis (inclusion, non-intersection tests) and ignores completely the notion of polygon winding (whether the
polygon edges are described clockwise or counter-clockwise). GDAL must be built with GEOS enabled to make geometry test work. Polygons are exposed as multipolygons in the OGR Simple Feature model.<p>

Ellipses and circles are discretized as polygons with 360 points.<p>

<h2>Creation Issues</h2>

On export all layers are written to a single BNA file. Update of existing
files is not currently supported.<p>
If the output file already exits, the writing will not occur. You have to delete the existing file first.<p>

The BNA writer supports the following creation options (dataset options):
<ul>
<li> <b>LINEFORMAT</b>:
By default when creating new .BNA files they are created with the line
termination conventions of the local platform (CR/LF on win32 or
LF on all other systems).  This may be overridden through use of the
LINEFORMAT layer creation option which may have a value of <b>CRLF</b>
(DOS format) or <b>LF</b> (Unix format). <p>
<li> <b>MULTILINE</b>:
By default, BNA files are created in the multi-line format (for each record, the first line contains the identifiers and the type/number of coordinates to follow. The following lines contains a pair of coordinates). This may be overridden through use of MULTILINE=<b>NO</b>. <p>
<li> <b>NB_IDS</b>:
BNA records may contain from 2 to 4 identifiers per record. Some software packages only support a precise number of identifiers. You can override the default value (2) by a precise value : <b>2</b>, <b>3</b> or <b>4</b>, or <b>NB_SOURCE_FIELDS</b>. NB_SOURCE_FIELDS means
that the output file will contains the same number of identifiers as the features written in (clamped between 2 and 4).<p>
<li> <b>ELLIPSES_AS_ELLIPSES</b>:
the BNA writer will try to recognize ellipses and circles when writing a polygon. This will only work if the feature has previously been read from a BNA file. As some software packages do not support ellipses/circles in BNA data file, it may be useful to tell the writer by specifying ELLIPSES_AS_ELLIPSES=<b>NO</b> not to export them as such, but keep them as polygons.<p>
<li> <b>NB_PAIRS_PER_LINE</b>:
this option may be used to limit the number of coordinate pairs per line in multiline format.<p>
<li> <b>COORDINATE_PRECISION</b>:
this option may be used to set the number of decimal for coordinates. Default value is 10.<p>
<p>

</ul>

<h2>VSI Virtual File System API support</h2>

(Some features below might require OGR >= 1.9.0)<p>

The driver supports reading and writing to files managed by VSI Virtual File System API, which include
"regular" files, as well as files in the /vsizip/ (read-write) , /vsigzip/ (read-write) , /vsicurl/ (read-only) domains.<p>

Writing to /dev/stdout or /vsistdout/ is also supported.<p>

<h2>Example</h2>

The ogrinfo utility can be used to dump the content of a BNA datafile :

<pre>
ogrinfo -ro -al a_bna_file.bna
</pre>

<P>
The ogr2ogr utility can be used to do BNA to BNA translation :

<pre>
ogr2ogr -f BNA -dsco "NB_IDS=2" -dsco "ELLIPSES_AS_ELLIPSES=NO" output.bna input.bna

</pre>


<h2>See Also</h2>

<ul>
<li> <a href="http://www.softwright.com/faq/support/boundary_file_bna_format.html">Description of the BNA file format</a><p>
<li> <a href="http://64.145.236.125/forum/topic.asp?topic_id=1930&forum_id=1&Topic_Title=how+to+edit+*.bna+files%3F&forum_title=Surfer+Support&M=False">Another description of the BNA file format</a><p>
<li> <a href="http://sedac.ciesin.org/plue/cenguide.html">Archive of Census Related Products (ACRP)</a> : downloadable BNA datasets of boundary files based on TIGER 1992 files containing U.S. census geographies<p>
</ul>

</body>
</html>
